<%@ page import="br.edu.ufam.controleAcesso.*" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main"/>
        <g:javascript src="app/grupo.js" />
    </head>
    <body>
      <h1>Cadastrar Grupo</h1><hr/>
          <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
          </g:if>
          <g:hasErrors bean="${grupo}">
            <div class="errors">
                <g:renderErrors bean="${grupo}" as="list" />
            </div>
          </g:hasErrors>
          <div id="validateErrors"class="errors" style="display:none;">
            <ul></ul>
          </div>
      <br/>
          <g:form name="formGrupo" controller="grupo" method="post" >
            <table  width="100%" border="0" cellspacing="5" cellpadding="0" align="center" class="textoverdana">
            <tr>
              <td>Descri&ccedil;&atilde;o: *<br/>
                  <input type="text" 
                         size="35" 
                         id="descricao" 
                         name="descricao" 
                         value="${fieldValue(bean:grupo,field:'descricao')}"
                         class="text ui-widget-content ui-corner-all"/>
              </td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>

            <tr>
                <td>Aplica&ccedil;&otilde;es dispon&iacute;veis:</td>
                <td>&nbsp;</td>
                <td>Aplica&ccedil;&otilde;es do grupo:</td>
            </tr>
            <tr>
              <td width="44%">
                <g:select style="width:100%" 
                          id="lista1" 
                          multiple="multiple" 
                          size="10" 
                          from='${Aplicacao.findAll("from Aplicacao a order by a.menu.descricao, a.descricao")}' optionKey="id" optionValue="${{it.menu.descricao+' - '+it.descricao}}" ></g:select>
              </td>
              <td style="text-align:center">
                <input name="moveRight" id="moveRight" type="button" class="botao" value="&gt;&gt;" onClick="move('lista1','lista2');"/> <br/> <br/>
                <input name="moveLeft" id="moveLeft" type="button" class="botao" value="&lt;&lt;"  onClick="move('lista2','lista1');"/>
              </td>
              <td width="44%">
                <select style="width:100%" id="lista2" name="lista2" multiple="multiple" size="10" />
              </td>
                <td>&nbsp;</td>
            </tr>
          </table>
          <p align="center">
              <g:actionSubmit class="botao" id="salvar" action="save" value="Cadastrar" onClick="seleciona('lista2');return validar();"/>
              <g:link action="list"><input class="botao" id="voltar" type="button" value="Voltar" /></g:link>
          </p>
              <p align="left"><em>*Campos Obrigat&oacute;rios</em></p>
      </g:form>

    </body>
</html>
